package main;

import java.util.Random;

public class WinningStrategy implements Strategy {
    private Random random = new Random();
    // 在 won 字段中保存了，上一局猜拳的输赢结果。
    private boolean won = false;
    // 在 preHand 字段中保存的是.上一局出的手势。
    private Hand preHand;

    @Override
    public Hand nextHand() {
        if (!won) {
            preHand = Hand.getHand(random.nextInt(3));
        }
        return preHand;
    }

    @Override
    public void study(boolean win) {
        won = win;
    }
}
